package com.google.project.client.Director;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.project.client.Sharing.CreateMessage;
import com.google.project.client.Sharing.DocumentList;
import com.google.project.client.Sharing.MessageDetail;
import com.google.project.client.Sharing.MessageList;
import com.google.project.client.Sharing.ProjectReportDetail;
import com.google.project.shared.MessageDTO;
import com.google.project.shared.ProjectDTO;
import com.google.project.shared.ProjectReportDTO;


public class DRTEntrypoint implements EntryPoint {

	interface ConnectrAppUiBinder extends UiBinder<DockLayoutPanel, DRTEntrypoint> {
	}

	private static final ConnectrAppUiBinder binder = GWT.create(ConnectrAppUiBinder.class);
	private static DRTEntrypoint singleton;

	
	// @formatter:off
	@UiField HeaderPanel headerPanel;
	@UiField ScrollPanel mainPanel;

	// @formatter:on

	RootLayoutPanel root;

	/** Gets the singleton application instance. */
	public static DRTEntrypoint get() {
		return singleton;
	}

	@Override
	public void onModuleLoad() {
		singleton = this;
		DockLayoutPanel outer = binder.createAndBindUi(this);
		root = RootLayoutPanel.get();
		root.add(outer);
		mainPanel.add(new DRTHomePage());
	}
	public void cancelEditFriend() {
		clearMainPanel();	
	}

	public void clearMainPanel() {
		mainPanel.clear();
	}
	public void DRTHomepage(){
		clearMainPanel();
		mainPanel.add(new DRTHomePage());
	}
	public void DRTProjectList(){
		clearMainPanel();
		mainPanel.add(new DRTProjectList());
	}
	public void DRTProjectList(int status) {
		clearMainPanel();
		mainPanel.add(new DRTProjectList(status));
	}
	public void DRTProjectReportList(){
		clearMainPanel();
		mainPanel.add(new DRTProjectReportList());
	}
	public void DRTProjectReportDetail(ProjectReportDTO projectReportDTO){
		clearMainPanel();
		mainPanel.add(new ProjectReportDetail(projectReportDTO));
	}
	public void DRTCreateMessage(){
		clearMainPanel();
		mainPanel.add(new CreateMessage());
	}
	public void DRTMessList(){
		clearMainPanel();
		mainPanel.add(new MessageList());
	}
	public void DRTMessDetail(MessageDTO mess){
		clearMainPanel();
		mainPanel.add(new MessageDetail(mess));
	}

	public void DRTProjectDetail(String projectID) {
		clearMainPanel();
		mainPanel.add(new DRTProjectDetail(projectID));
	}

	public void DRTSubConstructor(ProjectDTO currentProject) {
		clearMainPanel();
		mainPanel.add(new DRTSubConstructor(currentProject));
	}

	public void DocumentList(String projectID, String string,String projectName, String string2, int i) {
		clearMainPanel();
		mainPanel.add(new DocumentList(projectID,string,projectName,string2,i));
	}

	public void DRTHumanReq() {
		clearMainPanel();
		mainPanel.add(new DRTHumanReq());
	}
	
	public void DRTHumanReq(int _hmReqStatus) {
		clearMainPanel();
		mainPanel.add(new DRTHumanReq(_hmReqStatus));
	}

	public void DRTHumanReqDetail(ProjectDTO projectDTO) {
		clearMainPanel();
		mainPanel.add(new DRTHumanReqDetail(projectDTO));
	}

	public void Gantt(String pjId) {
		clearMainPanel();
		mainPanel.add(new Gantt(pjId));
	}
}
